#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int nTeams = 0;

typedef struct Winner
{
    char tname[100];
    int solved;
    int penalty;
}Winner;

typedef struct Pstatus
{
    int psub;
    int ptime;
}status;


Winner winner;

int main()
{
   // freopen("bin\\debug\\in.txt", "r", stdin);

    int i = 0, j = 0;
    char tname[100];
    int psub = 0, ptime = 0,penalty = 0, psolved = 0;

    scanf("%d", &nTeams);

    strcpy(winner.tname, "");
    winner.solved = 0;
    winner.penalty = 0;

    for(i = 0; i < nTeams; i++)
    {
        psolved = 0;
        penalty = 0;
        scanf("%s", tname);
        for(j = 0; j < 4; j++)
        {
            scanf("%d%d", &psub, &ptime);
            if(ptime != 0)
            {
                psolved++;
                penalty += (ptime + (psub-1) * 20);
            }
        }

        if((winner.solved < psolved)
           || (winner.solved == psolved && winner.penalty > penalty))
        {
            strcpy(winner.tname, tname);
            winner.solved = psolved;
            winner.penalty = penalty;
        }
    }

    printf("%s %d %d\n", winner.tname, winner.solved, winner.penalty);

    return 0;
}
